<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
  <%@ page import="java.sql.*"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<%
request.setCharacterEncoding("utf-8");
 String name=new String(request.getParameter("name"));
String pwd=new String(request.getParameter("pwd"));

  // 数据库连接字符串
  Class.forName("org.mariadb.jdbc.Driver");
  String url = "jdbc:mariadb://10.220.140.102:3366/studb14";
  // 数据库用户名
  String usename = "stu14";
  // 数据库密码
  String psw ="jyw745DJ";
  Connection conn = DriverManager.getConnection(url, usename, psw);
  String sql="insert into db_register(userName,password,realName,age,phoneNumber) values('"+name+"','"+pwd+"')";
    Statement stmt=conn.createStatement();                     //获取statement对象
    stmt.executeUpdate(sql);                                   //执行添加用户的sql语句
    request.getRequestDispatcher("FRIST.jsp").forward(request, response);  //请求转发到FRIST.jsp
%>
</body>
</html>ss